data{
    int<lower=1> N;
    int T[N];
    int VB[N];
    int VT[N];
    int VC[N];
    int AVT[N];
}
parameters{
    real a;
    real bVC;
    real bVB;
    real bVT;
    real bAVT;
}
model{
    vector[N] lp;
    bAVT ~ normal( 0 , 10 );
    bVT ~ normal( 0 , 10 );
    bVB ~ normal( 0 , 10 );
    bVC ~ normal( 0 , 10 );
    a ~ normal( 0 , 10 );
    for ( i in 1:N ) {
        lp[i] = a + (bVT + bVB * VB[i] + bVC * VC[i]) * VT[i] + bAVT * AVT[i];
    }
    T ~ binomial_logit( 1 , lp );
}
generated quantities{
    vector[N] lp;
    real dev;
    dev = 0;
    for ( i in 1:N ) {
        lp[i] = a + (bVT + bVB * VB[i] + bVC * VC[i]) * VT[i] + bAVT * AVT[i];
    }
    dev = dev + (-2)*binomial_logit_lpmf( T | 1 , lp );
}
